<?php


    @include_once('connect.php');

    $res = [];

    $id = $_GET['id'];

    // $id = 4;

    if($id){
        // 数字不用加引号，字符串才需要加引号
        $sql = "SELECT * FROM goods_list1 WHERE goods_id = $id";
        $ggo = mysqli_query($connect , $sql);

        $list = [];
        //多条数据
        while($arr = mysqli_fetch_array($ggo)){
            array_push($list,$arr);
        }
        

        //判断是否拿到数据
        if($list){
            $res['status'] = true;
            $res['msg'] = '请求成功'; 
            //得到对应id的数据
            $res['data'] = $list;
        }else{
            $res['status'] = false;
            $res['msg'] = '数据库错误';  
        }
    }else{
        $res['status'] = false;
        $res['msg'] = '前端数据有误';
    }

    echo(json_encode($res,JSON_UNESCAPED_UNICODE));